<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #app {
            margin: 10px;
        }

        .input-box {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .input-box input {
            flex: 1;
            height: 40px;
            border: none;
            outline: none;
            padding-left: 20px;
            background-color: #f5f5f5;
        }

        .input-box span {
            width: 60px;
            text-align: center;
            cursor: pointer;
            color: lightseagreen;
        }

        .suammry {
            display: flex;
            align-items: center;
            font-size: 14px;
        }

        .suammry span {
            display: inline-block;
            padding: 5px 15px;
            border-radius: 5px;
            background-color: lightseagreen;
            margin: 10px 0;
            margin-right: 10px;
            color: white;
        }

        .suammry span:nth-child(3) {
            background-color: red;
        }

        .box .title {
            font-weight: bold;
            line-height: 40px;
        }

        .box .list .task {
            color: white;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-left: 10px;
            margin: 10px 0;
            background-color: lightseagreen;
            line-height: 40px;
        }

        .box .list .task.unfinished {
            background-color: red;
        }

        .box .list .task span {
            cursor: pointer;
            display: inline-block;
            margin-right: 10px;
        }

        .empty {
            text-align: center;
            padding: 50px 0;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 输入框 -->
        <div class="input-box">
            <input type="text" placeholder="输入任务名称" v-model="taskName">
            <span @click="addTask">新增</span>
        </div>
        <!-- 统计 -->
        <div class="suammry">
            <span>全部任务( {{tasklist.length}} )</span>
            <span>已完成( {{tasklist.length-unFinishCount}} )</span>
            <span>未完成( {{unFinishCount}} )</span>
        </div>
        <!-- 任务列表 -->
        <div class="box">
            <div class="title">任务列表</div>
            <div class="list">
                <div :class="{ unfinished: item.status==false }" class="task" v-for="(item,index) in tasklist"
                    :key="index">
                    <div>
                        <span><input @click="changeStatus(item)" type="checkbox" :checked="item.status"></span>
                        <span>{{item.id}}</span>
                        <span>{{item.name}}</span>
                    </div>
                    <span @click = "remove(item,index)">删除</span>
                </div>

                <div v-show="tasklist.length == 0" class="empty">任务列表为空,请添加一个任务!</div>
            </div>
        </div>
    </div>
    <script src="../AnLi/vue-2.5.21.js"></script>
    <script src="./4.TodoList.js"></script>

</body>

</html>